package com.pmcc.core.service;

import com.pmcc.core.entity.Tags;
import com.pmcc.core.repository.TagsRepository;
import com.pmcc.utils.OnlineUser;
import com.pmcc.utils.ResultBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;

/**
 * Created by spurs on 2018/11/12.
 */
@Service
@Transactional
public class TagsService {
    @Autowired
    TagsRepository tagsRepository;

    public ResultBean add(Tags model){
        ResultBean resultBean = new ResultBean(ResultBean.SUCCESS);
        try {
            Tags tags = new Tags();
            tags.setTag(model.getTag());
            tags.setEmployeeId(model.getId());
            tagsRepository.saveAndFlush(tags);
            resultBean.setResultCode(ResultBean.SUCCESS);
        }catch (Exception e){
            resultBean.setResultCode(ResultBean.FAIL);
        }
        return resultBean;
    }
}
